package com.chengqs.leetcode.utils;

import java.util.Random;

public class DataGeneratorUtil {

    private static final Random random = new Random();

    public static int[] generateRandomIntArray(int size, int minValue, int maxValue) {
        int[] array = new int[size];

        // 生成随机数组
        for (int i = 0; i < size; i++) {
            array[i] = random.nextInt(maxValue - minValue + 1) + minValue;
        }

        return array;
    }

    public static String generateRandomString(int length) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            char c = (char) (random.nextInt(26) + 'a');
            sb.append(c);
        }
        return sb.toString();
    }
}
